package com.example.demo.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

/**
 * @author CJunGod 1038804380@qq.com
 *
 */
@Slf4j
@Component
public class ScheduledTasks {

	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
	
	@Value("${name.userName}")
	private String userName;
	
	@Scheduled(fixedRate = 60000)
	public void currentTime() {
		log.info("现在时间："+dateFormat.format(new Date())+" 我的名字是："+userName);
	}
}
